/*
 * (c) ralfoide, http://gamez.googlecode.com/, 2008
 * Project: gamez
 * License TBD
 */

package util;

import static org.junit.Assert.*;

import java.io.StringReader;
import java.util.ArrayList;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import util.BlenderTextFileReader.Object3d;
import util.BlenderTextFileReader.ParseError;

//-----------------------------------------------

public class BlenderTextFileReaderTest {

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test(expected=ParseError.class)
	public final void testBlenderTextFileReader_empty() throws ParseError {
		new BlenderTextFileReader(new StringReader(""));
	}

	@Test
	public final void testBlenderTextFileReader_obj1() throws ParseError {
		BlenderTextFileReader r = new BlenderTextFileReader(new StringReader(
				"RB1\nOBJ:toto\nVert 0\nFaces 0"));
		assertNotNull(r);
		ArrayList<Object3d> result = r.getObjects();
		assertNotNull(result);
		assertEquals(1, result.size());
		assertEquals("toto", result.get(0).getName());
		assertEquals(0, result.get(0).getVertices().length);
		assertEquals(0, result.get(0).getIndices().length);
	}

}
